<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
    <div class="table-responsive">
        <table class="table table-bordered">
            <thead>
            <tr>
                <th class="text-center">
                    <div>ID</div>
                </th>
                <th class="text-center" width="17%">图书名称</th>
                <th class="text-center" width="12%">专业/科目</th>
                <th class="text-center" width="8%">
                    <span th:if="${selaSwitch}=='3'">原价/销售价/会员价</span>
                    <span th:if="${selaSwitch}!='3'">原价/销售价</span>
                </th>
                <th class="text-center" width="8%">作者</th>
                <th class="text-center" width="12%">出版社</th>
                <th class="text-center" width="12%">出版时间</th>
                <th class="text-center" width="8%">ISBN</th>
                <th class="text-center" width="5%">库存</th>
                <th class="text-center" width="5%">状态</th>
                <th class="text-center" width="8%">操作</th>
            </tr>
            </thead>
        </table>
        <div class="J_V_tabContent table-xScrollWrap">
            <table class="table table-bordered table-hover table-xs-content">
                <tbody id="tbodyMaterial">
                <tr class="jqgfirstrow" role="row">
                    <td role="gridcell">
                        <div class="table-first-id">&nbsp;</div>
                    </td>
                    <td class="text-center" width="17%"></td>
                    <td class="text-center" width="12%"></td>
                    <td class="text-center" width="8%"></td>
                    <td class="text-center" width="8%"></td>
                    <td class="text-center" width="12%"></td>
                    <td class="text-center" width="12%"></td>
                    <td class="text-center" width="8%"></td>
                    <td class="text-center" width="5%"></td>
                    <td class="text-center" width="5%"></td>
                    <td class="text-center" width="8%"></td>
                </tr>
                <tr th:if="${#lists.isEmpty(dataMap['list'])}">
                    <td colspan="11" class="text-center">
                        <div class="noDataTipsBox">
                            <p><span class="c-4e fs16">亲，还没有数据~~~</span></p>
                        </div>
                    </td>
                </tr>
                <tr th:if="!${#lists.isEmpty(dataMap['list'])}" th:each="book : ${dataMap['list']}" th:attrappend="data-id=${book['id']},data-name=${book['bookName']},id='book-'+${book['id']}">
                    <td class="text-center">
                        <input type="checkbox" class="i-checks" th:value="${book['id']}">
                    </td>
                    <td class="text-center" th:text="${book['bookName']}"></td>
                    <td class="text-center">
                        <th:block th:if="!${#lists.isEmpty(book['subjectList'])}">
                            <span class="pie" th:each="subject,subIndex : ${book['subjectList']}">
                                <th:block th:text="${subject['subjectName']}+'/'"></th:block>
                                <th:block th:if="!${#lists.isEmpty(subject['childSubjectList'])}" th:each="child,index : ${subject['childSubjectList']}">
                                    <th:block th:if="${index.last} == false" th:text="${child['subjectName']}+'/'"></th:block>
                                    <th:block th:if="${index.last} == true" th:text="${child['subjectName']}"></th:block>
                                </th:block>
                                <th:block th:if="${#lists.isEmpty(subject['childSubjectList'])}">全部科目</th:block>
                                <th:block th:if="${subIndex.last}==false" th:utext="'<br/>'"></th:block>
                            </span>
                        </th:block>
                        <th:block th:if="${#lists.isEmpty(book['subjectList'])}">
                            <span class="pie">—</span>
                        </th:block>
                    </td>
                    <td class="text-center">
                        <span th:if="${selaSwitch}=='3'" th:text="${book['rawPrice']}+'/'+${book['realPrice']}+'/'+${book['memberPrice']}"></span>
                        <span th:if="${selaSwitch}!='3'" th:text="${book['rawPrice']}+'/'+${book['realPrice']}"></span>
                    </td>
                    <td class="text-center" th:text="${book['author']}"></td>
                    <td class="text-center" th:text="${book['bookPress']}"></td>
                    <td class="text-center" th:text="${#strings.substring(book['publishTime'],0,10)}"></td>
                    <td class="text-center" th:text="${book['bookISBN']}"></td>
                    <td class="text-center" th:text="${book['stockNum']}"></td>
                    <td class="text-center" th:attrappend="id='status-'+${book['id']},data-status=${book['status']}">
                        <span th:if="${book['status']}==0" class="label label-default">未指定</span>
                        <span th:if="${book['status']}==1" class="label label-info">上架</span>
                        <span th:if="${book['status']}==2" class="label label-danger">下架</span>
                    </td>
                    <td class="text-center">
                        <a href="javascript:void(0)" th:attrappend="data-id=${book['id']}" class="c-master fs14" data-toggle="tooltip" data-placement="top" data-original-title="查看"><i class="fa fa-eye"></i></a>
                        <a th:href="@{/admin/book/initUpdate?id={id}(id=${book['id']})}" class="c-master fs14 ml5" data-toggle="tooltip" data-placement="top" data-original-title="修改"><i class="fa fa-edit"></i></a>
                        <a th:if="${book['status']}==0 or ${book['status']}==2" th:attrappend="data-id=${book['id']},id='status-action-'+${book['id']}" href="javascript:void(0);" class="c-master fs14 ml5" data-toggle="tooltip" data-placement="top" data-original-title="上架"><i class="fa fa-arrow-up"></i></a>
                        <a th:if="${book['status']}==1" th:attrappend="data-id=${book['id']},id='status-action-'+${book['id']}" href="javascript:void(0);" class="c-master fs14 ml5" data-toggle="tooltip" data-placement="top" data-original-title="下架"><i class="fa fa-arrow-down"></i></a>
                        <a th:attrappend="data-id=${book['id']}" href="javascript:void(0);" class="c-master fs14 ml5" data-toggle="tooltip" data-placement="top" data-original-title="删除"><i class="fa fa-trash"></i></a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <!-- 分页，开始 -->
        <div data-th-replace="layout/adminPage"></div>
        <!-- 分页，结束 -->
    </div>
</html>